package oop6.Task;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Course {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        try {
            System.out.print("输入总课时：");
            int sumtTime = input.nextInt();
            if (sumtTime < 100)
                throw new Exception();
            System.out.print("输入课程数：");
            int courseNumber = input.nextInt();
            double average = sumtTime / courseNumber;
         
            System.out.println("平均课时为：" + average);
        } catch (InputMismatchException e) {
            System.out.println("输入的不是整数");
            e.getStackTrace();
        } catch (ArithmeticException e) {
            System.out.println("总课程数为0，导致除法运算错误错误");
            e.getStackTrace();
        } catch (Exception e) {
            System.out.println("总课时少于100，课时太少");
            e.getMessage();
        }
    }
}
